import random
import card

DECKSIZE = 6
class Deck(object):
    def __init__(self, num=1):

        self._face = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
        self._suit = [0, 1, 2, 3]

        self.refill(num)

    def refill(self, num):
        self._deck = []

        for d in range(num):
            for i in range(len(self._suit)):
                for j in range(len(self._face)):
                    self._deck.append(card.Card(j, i))
        self.shuffle()

    def shuffle(self):
        random.shuffle(self._deck)

    def pretty_print(self):
        for i in range(len(self._deck)):
            self._deck[i].display()

    def deal_card(self):
        dealtCard = None
        try:
            dealtCard = self._deck.pop()
        except IndexError:
            self.refill(DECKSIZE)
            dealtCard = self._deck.pop()
        return dealtCard
